package com.siysoft.util;

import java.util.Comparator;

/**
 * 字符串以整型数排序
 * @author wyj
 *
 * @param <T>
 */
public class Str2IntComparator<T> implements Comparator<T>  {
	
	public int compare(T element1, T element2) {
		if(element1.getClass().equals(String.class)){
			Integer int1 = new Integer(element1+"");
			Integer int2 = new Integer(element2+"");
			//升序
			return int1 - int2;
		}else{
			Integer int1 = (Integer)element1;
			Integer int2 = (Integer)element2;
			return int1 - int2;
		}
	}

}
